<!-- 网站信息 -->
<template>
    <div class=''>
        <a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
            <a-form-model-item label="网站名称" prop="websiteName">
                <a-input v-model="form.websiteName" />
            </a-form-model-item>
            <a-form-model-item label="主页名称" prop="indexName">
                <a-input v-model="form.indexName" />
            </a-form-model-item>
            <a-form-model-item label="备案号" prop="recordNum">
                <a-input v-model="form.recordNum" />
            </a-form-model-item>
            <a-form-model-item label="版权信息">
                <a-input v-model="form.copyrightInformation" />
            </a-form-model-item>
            <a-form-model-item label="网站描述">
                <a-input v-model="form.websiteDesc" />
            </a-form-model-item>
            <a-form-model-item v-has="'web:webSite:edit'" :wrapper-col="{ span: 14, offset: 4 }">
                <a-button type="primary" style="margin-left: 10px;" @click="onSubmit">
                    保存
                </a-button>
            </a-form-model-item>
        </a-form-model>
    </div>
</template>

<script>
import { setConfigWebsite } from '@/api/web/web'
export default {
    components: {
    },
    data() {
        return {
            labelCol: { span: 4 },
            wrapperCol: { span: 14 },
            form: {
                websiteName: undefined,
                indexName: undefined,
                recordNum: undefined,
                // language: undefined,
                // defLanguage: undefined,
                copyrightInformation: undefined,
                websiteDesc: undefined,
                websiteDomain: undefined,
                customerDomain: undefined
            },
            rules: {
                websiteName: [{ required: true, message: '请输入网站名称', trigger: 'blur' }],
                indexName: [{ required: true, message: '请输入主页名称', trigger: 'blur' }],
                recordNum: [{ required: true, message: '备案号', trigger: 'blur' }],
                webDomain: [{ required: true, message: '请输入网站域名', trigger: 'blur' }]
            }
        }
    },
    computed: {},
    watch: {},
    methods: {
        async onSubmit() {
            this.$refs.ruleForm.validate(async valid => {
                if (valid) {
                    let { code, msg } = await setConfigWebsite(this.form)
                    this.$message[code === 0 ? 'success' : 'error'](msg)
                    if (code === 0) {
                        this.$emit('update')
                    }
                }
            });
        },
    },
    created() {

    },
    mounted() {

    },
}
</script>
<style scoped>
</style>